package lc;

public class lc640 {
    public String solveEquation(String equation) {
        String[] s = equation.split("=");
        int l = 0, r = 0;
        for (int i = 0; i < s[0].length(); i++) {
            char c = s[0].charAt(i);
            if (c == 'x'){
                if(i == 0) l++;
                else if(s[0].charAt(i - 1) == '-') l--;
                else if (s[0].charAt(i - 1) == '+') l++;
                else{
                    int j = i - 1;
                    while (s[0].charAt(j) != '+' || s[0].charAt(j) != '-' || j != 0){
                        j--;
                    }
                    if (s[0].charAt(j) == '+') l += Integer.parseInt(s[0].substring(j + 1, i));
                    else if(s[0].charAt(j) == '-' ) l -= Integer.parseInt(s[0].substring(j + 1, i));
                    else l += Integer.parseInt(s[0].substring(0, i));
                }
            }else if (c == '+'){

            }else if(c == '-'){

            }
        }
        return " ";
    }
}
